From e5fe75a3d2d7480c83d1ece7bfaf965989b18979 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sat, 31 Dec 2016 19:15:29 +0100 Subject: [PATCH] hash-table: simplify integer hashing --- babl/babl-hash-table.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/babl/babl-hash-table.c b/babl/babl-hash-table.c index d507cb2..e1c2e56 100644 --- a/babl/babl-hash-table.c +++ b/babl/babl-hash-table.c @@ -58,15 +58,11 @@ babl_hash_by_int (BablHashTable *htab, int id) { int hash = 0; - int i; - - for (i = 0; i < sizeof (int); i++) - { - hash += id & 0xFF; - hash += (hash << 10); - hash ^= (hash >> 6); - id >>= 8; - } + hash += id & 0xFF; + hash += (hash << 10); + hash ^= (hash >> 6); + id >>= 8; + hash += id & 0xFF; hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); -- 2.30.2